/* Paul Day 05/21/2008 */

use InOut
/* ************* Create Table Teams ************* */
create table "Teams" (
	"Id"					int identity not null
		constraint PK_Teams_Id primary key nonclustered,
	"Description"			varchar(100) not null)

go

/* ************* Create Table MemberTeams ************* */
create table "MemberTeams" (
	"Id"					int identity not null
		constraint PK_MemberTeams_Id primary key nonclustered,
	"UserId"				uniqueidentifier not null
		references aspnet_Membership(UserId),
	"TeamId"				int not null
		references Teams(id))
		
go
	
/* ************* Create Table Profiles ************* */
create table "Profiles" (
	"UserId"				uniqueidentifier not null
		constraint PK_Profiles_UserId primary key nonclustered
		references aspnet_Membership(UserId),
	"FirstName"				varchar(60) null,
	"LastName"				varchar(100) null,
	"Birthdate"				datetime null,
	"OfficePhone"			varchar(15) null,
	"RemotePhone"			varchar(15) null,
	"Status"				varchar(128) not null
		default 'out',
	"InStatus"				bit not null,
	"OfficeStatus"			bit not null,
	"DateTimeLastUpdated"	datetime not null
		default getdate(),
	"TicksLastUpdated"		bigint not null)

go

/* ************* Create Table Updates ************* */
create table "Updates" (
	"Id"					int identity not null
		constraint PK_Updates_Id primary key nonclustered,
	"Active"				bit not null,
	"UserId"				uniqueidentifier not null
		references aspnet_Membership(UserId),
	"UpdateText"			text not null,
	"DateTimeEntered"		datetime not null)
	
go

/* ************* Create Table Logs ************* */
create table "Logs" (
	"Id"					int identity not null
		constraint PK_Log_Id primary key nonclustered,
	"UserName"				varchar(256) not null,
	"Application"			varchar(100) not null,
	"Category"				varchar(100) not null,
	"DateTimeEntered"		datetime not null,
	"Message"				varchar(500) not null,
	"Severity"				varchar(50) not null,
	"SeverityDescr"			varchar(500) not null)
	
go

/* ************* Create Table UpdateActivity ************* */
create table "UpdateActivity" (
	"Id"					int identity not null
		constraint PK_UpdateActivity_Id primary key nonclustered,
	"Activity"				varchar(20) not null,
	"DateTimeActivity"		bigint not null,
	"UserId"				uniqueidentifier not null
		references aspnet_Membership(UserId),
	"UpdateId"				int not null
		references Updates(Id))
	
go

/* ************* Create Table Quotes ************* */
create table "Quotes" (
	"Id"					int identity not null
		constraint PK_Quotes_Id primary key nonclustered,
	"UserId"				uniqueidentifier not null
		references aspnet_Membership(UserId),
	"Author"				varchar(100) not null,
	"QuoteText"				text  not null,
	"Approved"				bit not null
		default false)

go

/* ************* Create Table Tasks ************* 
create table "Tasks" (
	"Id"					int identity not null
		constraint PK_Updates_Id primary key nonclustered,
	"UserId"				uniqueidentifier not null
		references aspnet_Membership(UserId),
	"UpdateText"			text not null,
	"DateTimeEntered"		datetime not null)
	
go
  ************* Create Table Tasks **************/

